<%@page import="cn.lily.com.enviroment.Enviroment"%>
<%@ page contentType="text/html; charset=utf-8" %>
<%@page import="cn.lily.com.db.DBFactory"%>
<%@page import="cn.lily.com.db.container.reader.DataTable"%>
<%@ page import="cn.lily.inst.web.frames.FrameConfig" %>
<%@ page import="cn.lily.web.util.context.WebContext" %>
<%@ page import="cn.lily.esb.context.AuthEntity" %>
<%@ include file="/frames/logbegin.jsp" %>
<%
  String skinName = "";
  String contextPath ="";
  AuthEntity authEntity = (AuthEntity) session.getAttribute(WebContext.LOG_AUTH_CONTEXT);
  if (authEntity != null) {
    skinName      = authEntity.getSkinName();
    contextPath = authEntity.getContextPath();
  }
  FrameConfig.setContextPath(contextPath);
  String appSql="";
  if("9999".equals(authEntity.getOperatorId())){
    appSql="SELECT a.APP_ID,a.VER_COD,v.VER_NAM,i.APP_NAM,i.APP_PATH,i.SIGN_ICO,i.APP_DES,i.OPER_TIM FROM  ${schema}.app_ver_publish a  LEFT JOIN ${schema}.app_info i on a.APP_ID=i.APP_ID LEFT JOIN ${schema}.app_version v on a.APP_ID=v.APP_ID AND a.VER_COD=v.VER_COD ";
  }else{
    appSql="SELECT a.APP_ID,a.VER_COD,v.VER_NAM,i.APP_NAM,i.APP_PATH,i.SIGN_ICO,i.APP_DES,i.OPER_TIM FROM ${schema}.pw_oper o, ${schema}.pt_mer_app_auth a ,${schema}.app_info i ,${schema}.app_version v WHERE o.COMM_ID=a.COMM_ID AND a.APP_ID=i.APP_ID AND a.APP_ID=v.APP_ID AND a.VER_COD=v.VER_COD AND o.OPER_NO='"+authEntity.getOperatorId()+"'";
  }
  
  DataTable appTable=DBFactory.getActionDB().executeQueryTable(appSql);
  
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta charset=utf-8>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><%=FrameConfig.getAppName()%></title>
  <link href="<%=contextPath+FrameConfig.getStylePath()%>/strap/bootstrap.min.css" rel="stylesheet" media="screen">
  <link href="<%=FrameConfig.getCSSPath("app.css") %>" rel="stylesheet" />
  <link href="<%=contextPath+FrameConfig.getStylePath()%>/font-awesome/css/font-awesome.min.css" rel="stylesheet">

</head>
<body>
  <!-- <div class="topbar"></div> -->
  <div class="row" >
    <%
      while(appTable.next()){
        %>
        <div class="span2" >
          <a href="javascript:void(0)" onclick="openapp(this)" appid="<%=appTable.getString("APP_ID") %>" vercode="<%=appTable.getString("VER_COD") %>" appname="<%=appTable.getString("APP_NAM") %>">
            <img src="/smsp/data_statement_2_75.png" alt="">
            <div><%=appTable.getString("APP_NAM") %>-<%=appTable.getString("VER_NAM") %>版</div>
          </a>
        </div>
        <%
      }
    %>
  </div>
<%@ include file="/frames/logend.jsp" %>
  <script src="<%=FrameConfig.getBaseJsUrl() %>/common/jquery-1.9.1.min.js"></script>
  <script src="<%=FrameConfig.getBaseJsUrl()%>/strap/bootstrap.min.js"></script>
  <script src="<%=FrameConfig.getJsUrl("app.js")%>"></script>
</body>
</html>

